home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / WFC010.ZIP / INCLUDE / CNETSHAR.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-07  |  2.4 KB  |  98 lines

  1. #if ! defined( NETWORK_SHARE_CLASS_HEADER )
  2.  
  3. /*
  4. ** Author: Samuel R. Blackburn
  5. ** CI$: 76300,326
  6. ** Internet: sammy@sed.csc.com
  7. **
  8. ** You can use it any way you like as long as you don't try to sell it.
  9. **
  10. ** Any attempt to sell WFC in source code form must have the permission
  11. ** of the original author. You can produce commercial executables with
  12. ** WFC but you can't sell WFC.
  13. **
  14. ** Copyright, 1995, Samuel R. Blackburn
  15. **
  16. ** $Workfile: $
  17. ** $Revision: $
  18. ** $Modtime: $
  19. */
  20.  
  21. #define NETWORK_SHARE_CLASS_HEADER
  22.  
  23. class CNetworkShareInformation : public CObject
  24. {
  25.    DECLARE_SERIAL( CNetworkShareInformation )
  26.  
  27.    private:
  28.  
  29.       void m_Initialize( void );
  30.  
  31.    public:
  32.  
  33.       CNetworkShareInformation();
  34.       CNetworkShareInformation( SHARE_INFO_2 *information_p );
  35.       CNetworkShareInformation( const CNetworkShareInformation& source );
  36.       virtual ~CNetworkShareInformation();
  37.  
  38.       CString NetworkName;
  39.       DWORD   Type;
  40.       CString Remark;
  41.       DWORD   Permissions;
  42.       DWORD   MaximumNumberOfUses;
  43.       DWORD   CurrentNumberOfUses;
  44.       CString PathName;
  45.       CString Password;
  46.  
  47.       /*
  48.       ** Can't make Copy take a const pointer because Microsoft screwed up the 
  49.       ** net API header files...
  50.       */
  51.  
  52.       virtual void Copy( SHARE_INFO_2 *source );
  53.       virtual void Copy( const CNetworkShareInformation& source );
  54.       virtual void Empty( void );
  55.       virtual void Serialize( CArchive& archive );
  56. };
  57.  
  58. class CNetworkShares : public CNetwork
  59. {
  60.    DECLARE_SERIAL( CNetworkShares )
  61.  
  62.    private:
  63.  
  64.       void m_Initialize( void );
  65.  
  66.    protected:
  67.  
  68.       /*
  69.       ** Connection information variables
  70.       */
  71.  
  72.       SHARE_INFO_2 *m_2InformationBuffer;
  73.  
  74.       /*
  75.       ** File Information enumeration variables
  76.       */
  77.  
  78.       DWORD m_2ResumeHandle;
  79.       DWORD m_2CurrentEntryNumber;
  80.       DWORD m_2NumberOfEntriesRead;
  81.       DWORD m_2TotalNumberOfEntries;
  82.  
  83.    public:
  84.  
  85.       CNetworkShares();
  86.       CNetworkShares( LPCTSTR machine_name );
  87.       virtual ~CNetworkShares();
  88.  
  89.       virtual BOOL  Add( CNetworkShareInformation& share_to_add );
  90.       virtual void  Close( void );
  91.       virtual BOOL  Delete( CNetworkShareInformation& share_to_delete );
  92.       virtual BOOL  Enumerate( void );
  93.       virtual BOOL  GetNext( CNetworkShareInformation& information );
  94.       virtual void  Serialize( CArchive& archive );
  95. };
  96.  
  97. #endif // NETWORK_SHARE_CLASS_HEADER
  98.